<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  <!-- 为 ECharts 准备一个定义了宽高的 DOM -->
  <div id="main" style="width: 600px;height:400px;"></div>
</body>
<script src="https://lib.baomitu.com/echarts/4.8.0/echarts.js"></script>
<script>
  // 基于准备好的dom，初始化echarts实例
  var myChart = echarts.init(document.getElementById('main'));

  const data = [{
    "title": "星期一",
    "number": 100
  },{
    "title": "星期二",
    "number": 150
  },{
    "title": "星期三",
    "number": 700
  },{
    "title": "星期四",
    "number": 559
  },{
    "title": "星期五",
    "number": 180
  },{
    "title": "星期六",
    "number": 680
  }];

  const xTitle = data.map(val=>val.title);
  const seriesData = data.map(val=>val.number);

  // 指定图表的配置项和数据
  var option = {
    title: {
      text: 'ECharts 入门示例'
    },
    tooltip: {},
    legend: {
      data: ['库存', "销量"]
    },
    xAxis: {
      data: xTitle
    },
    yAxis: {},
    series: [
      {
        name: '库存',
        type: 'pie',
        data: seriesData
      },
      {
        name: '销量',
        type: 'pie',
        data: seriesData
      }
    ]
  };

  // 使用刚指定的配置项和数据显示图表。
  myChart.setOption(option);



  
</script>
</html>